home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / msker312.zip / HAYES.SCR < prev    next >
Text File  |  1991-09-17  |  5KB  |  121 lines

  1. ; FILE HAYES.SCR
  2. ;
  3. ; To be used with MS-DOS Kermit 3.11 or later.
  4. ;
  5. ; An MS-DOS Kermit script program for dialing Hayes 2400 Smartmodems and
  6. ; compatibles.  Should also work with Hayes 1200, and ROLMphone 244PCs.
  7. ;
  8. ; Stored in Kermit Distribution as MSIHAY.SCR; rename to HAYES.SCR if
  9. ; necessary so the DIAL macro can find it.  Place this file in your current
  10. ; directory, or any directory in your DOS PATH.
  11. ;
  12. ; Expects variable \%1 to contain the phone number; this is done by the DIAL
  13. ; macro defined in MSKERMIT.INI.  If you lack the DIAL macro definition, use
  14. ; this simple substitute:
  15. ;   DEFINE DIAL TAKE HAYES.SCR
  16. ; To use, just type DIAL nnnnnnn at the MS-Kermit> prompt, where nnnnnnn is
  17. ; the desired phone number.
  18. ;
  19. ; Uses ATD (modem's default dialing method) to dial the number.  Force tone
  20. ; dialing by including T as first character of phone number, or pulse dialing
  21. ; by including P as first character.
  22. ;
  23. ; Sets SUCCESS flag if dialing succeeds, sets FAILURE flag if it fails, for
  24. ; use with IF SUCCESS, IF FAILURE, \v(status).
  25. ;
  26. ; Puts the Hayes modem in the following modes, which this script depends upon
  27. ; for proper operation:
  28. ;   Q0 = Enable result codes
  29. ;   V1 = Use verbose (English) result codes
  30. ;   X1 = Enable result codes OK, CONNECT, RING, NO CARRIER, ERROR,
  31. ;        CONNECT 1200, CONNECT 2400
  32. ; These are set by the statement:
  33. ;   output ATQ0V1X1\13
  34. ; If these modes don't agree with your modem's normal settings, you can add
  35. ; OUTPUT commands to restore the desired settings just before the two END
  36. ; statements at the end of this file.
  37. ;
  38. ; Hayes modems do not issue any messages like RINGING or RRING when the other
  39. ; phone is ringing, but certain Hayes-compatible modems do, like Telebit.  If
  40. ; you experience problems with this, comment (or uncomment) the appropriate
  41. ; statement below, in the "GOTMSG" section below.  (Note: RING is different:
  42. ; it means another modem is calling your modem.)
  43. ;
  44. ; Note: If the HANGUP command does not work for you, try this:
  45. ;  (1) Change all references to HANGUP to HANGITUP;
  46. ;  (2) define hangitup pause 1, output +++, pause 1, output ath0\13
  47. ;
  48. ; Author: Christine M. Gianone, January 1990
  49. ; Updated for MS-DOS Kermit version 3.11, July 1991
  50. def errfail echo \%1,hangup,goto fail ; Macro to handle failures.
  51.  
  52. if < VERSION 311 errfail {MS-DOS Kermit 3.11 or later required.}
  53. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE
  54. set input echo off              ; Don't echo the modem test
  55. output ATQ0V1X1\13              ; Send AT, use word result codes.
  56. input 2 OK                      ; Modem should say "OK"
  57. if fail errfail {Turn on or connect your modem!}
  58. clear                ; Clear input buffer
  59. set count 5                     ; Set up dialing retry counter
  60. set input echo on               ; From now on, show what happens
  61. echo Dialing \%1, wait...
  62. pause 1
  63. goto dial                       ; 1st time, skip Redialing message
  64.  
  65. :REDIAL
  66. pause 30            ; Wait 30 seconds before redialing.
  67. echo Redialing...               ; Message for redialing.
  68. pause 1
  69.  
  70. :DIAL
  71. output ATD\%1\13                ; Dial the number (ATDT or ATDP)
  72. ;;;pause 20            ; *** Might be necessary for some modems.
  73. set alarm 60            ; Detect keyboard interruptions.
  74. clear                ; Clear INPUT buffer.
  75. input 40 \10                    ; Wait for the linefeeds...
  76.  
  77. :GETMSG
  78. input 20 \10            ; that surround response message.
  79. if success goto gotmsg        ; Got a message.
  80. if alarm errfail {No response from modem.} ; No response in 60 secs.
  81. hangup                ; User interrupted from keyboard,
  82. goto again            ; so try again right away
  83.  
  84. :GOTMSG
  85. reinput 0 CONNECT               ; Got message, was it CONNECT?
  86. if success goto speed           ; Yes, go check the speed.
  87. reinput 0 ERROR            ; No, check for command error.
  88. if success errfail {Modem command error.}
  89. reinput 0 NO CARRIER        ; NO CARRIER?
  90. if success goto busy        ; Treat like BUSY.
  91. reinput 0 BUSY                  ; BUSY?
  92. if success goto busy         ; Go wait a bit, then dial again.
  93. reinput 0 RRING            ; *** No, check for RRING (Telebit only).
  94. if success goto getmsg        ; *** RRING, just wait for next message.
  95. ; reinput 0 RINGING        ; *** No, check for RINGING (not real Hayes).
  96. ; if success goto getmsg    ; *** RINGING, just wait for next message.
  97. errfail {No dialtone or no answer.  Try again later.}
  98.  
  99. :BUSY
  100. if < \v(count) 2 goto quit    ; Don't wait 60 seconds if tries used up.
  101. Echo Busy or No Carrier, will dial again in 30 seconds...
  102. hangup                          ; Hang up.
  103. :AGAIN
  104. if count goto redial            ; Then go redial.
  105. :QUIT
  106. errfail {It never answers!  I give up.} ; Too many tries.
  107.  
  108. :SPEED                          ; Connected!
  109. echo \7                         ; Celebrate with a beep.
  110. reinput 0 1200                  ; Was the message CONNECT 1200?
  111. if success set speed 1200       ; Yes, change the speed.
  112. reinput 0 2400            ; Was it CONNECT 2400?
  113. if success set speed 2400    ; Yes, change speed.
  114. define errfail            ; Erase ERRFAIL definition
  115. end 0                ; Finished, return success code.
  116.  
  117. :FAIL                ; Dialing failed.
  118. define errfail            ; Erase ERRFAIL definition
  119. end 1                ; Return failure code.
  120.